<?php
$title = 'Gestion des marchés';
$this->headTitle($title);
$this->headScript()->prependFile($this->basePath()."/js/operationtest/script-editable.js");
$this->headScript()->prependFile($this->basePath()."/js/operationtest/add-toggle.js");
?>
<div class="content-head">
    <h3><?php echo $title; ?></h3>
    <div class="toolbar">        
        <div class="cancel" title="Annuler"></div>
        <div class="toggle add" title="Ajouter"></div>
    </div>
</div>
<div class="content-body">
    <div id="msg" class="alert hide"></div>
    <div class="add-toggle">
        <table class="table">
            <tr>
                <td width="20%">
                    <p class="entete">Libellé</p>
                    <div class="champ">
                        <a class="editable a-libelle" 
                            data-original-title="Saisissez un libelle"
                            data-name="libelle"
                            data-type="text"></a>
                    </div>
                </td>
                <td width="70%">
                    <p class="entete">Description</p>
                    <div class="champ">
                        <a class="editable a-description" 
                            data-original-title="Saisissez une description"
                            data-name="description"
                            data-type="textarea"></a>
                    </div>
                </td>
                <td width="10%" style="text-align:center">
                    <p class="entete">Active</p>
                    <div class="champ">
                        <a class="editable a-libelle" 
                            data-original-title="Active ou non"
                            data-name="active"
                            data-source="[{value: 1, text: 'Oui'},{value: 0, text: 'Non'}]" 
                            data-type="select"></a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="list-container">
        <table class="table table-striped list-table">
            <thead>
                <tr>
                    <th width="20%">Libellé</th>
                    <th>Description</th>
                    <th width="10%">Active</th>
                    <th width="10%"></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($marches as $marche): ?>
                <tr id="row_<?php echo $marche->idMarche; ?>">
                    <td>
                        <a class="editable a-libelle" 
                            data-original-title="Saisissez un libelle" 
                            data-pk="<?php echo $marche->idMarche; ?>" 
                            data-name="libelle"
                            data-type="text"><?php echo $marche->libelle; ?></a>
                    </td>
                    <td>
                        <a class="editable a-description" 
                            data-original-title="Saisissez une description" 
                            data-pk="<?php echo $marche->idMarche; ?>" 
                            data-name="description"
                            data-type="textarea"><?php echo $marche->description; ?></a>
                    </td>
                    <td style="text-align:center">
                        <a class="editable a-active" 
                            data-original-title="Active ou non" 
                            data-pk="<?php echo $marche->idMarche; ?>" 
                            data-name="active"
                            data-value="<?php echo $marche->active; ?>"
                            data-source="[{value: 1, text: 'Oui'},{value: 0, text: 'Non'}]" 
                            data-type="select"></a>
                    </td>
                    <td class="center" style="vertical-align:middle">
                        <img title="Editer" src="<?php echo $this->basePath()."/img/operationtest/modifier.png"?>" border="0" alt="Editer" class="enable" style="cursor:pointer" />
                        &nbsp;&nbsp;&nbsp;
                        <img title="Attribuer boutiques" src="<?php echo $this->basePath()."/img/operationtest/modifier-marche.png"?>" border="0" alt="Editer boutiques" class="delete" style="cursor:pointer" onClick="attribStore(<?php echo $marche->idMarche; ?>)" />
                        &nbsp;&nbsp;&nbsp;
                        <img title="Supprimer" src="<?php echo $this->basePath()."/img/operationtest/supprimer.png"?>" border="0" alt="Supprimer" class="delete" style="cursor:pointer" onClick="cDelete(<?php echo $marche->idMarche; ?>)" /></a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
